﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Job.Entity;
using Job.Logic.Common;
using Job.Web.Framework;

namespace Job.Web.AdminWeb
{
    public partial class AdminMain : BasePage
    {
        private int controlType
        {
            get { return myR["controlType"].IntValue; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            MySession session = new MySession();
            if (session.GetAdminUserFromSession() == null)
            {
                Response.Write("<script language='javascript'> if (top.dialogArgument != null){window.close();top.dialogArguments.top.location.href='AdminLogin.aspx';} top.window.location.href='AdminLogin.aspx';</script>");
                return;
            }
            this.LoadControl();            
        }
        private void LoadControl()
        {
            string filePath = string.Empty;
            bool isEdit = (myR["edit"].IntValue == 1);

            switch (controlType)
            {
                case (int)Constants.SubjectType.CompanyNews:          //无忧新闻
                    {
                        this.Title = "无忧资讯 > 无忧新闻";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }

                case (int)Constants.SubjectType.CompanyDescription:   //关于无忧
                    {
                       this.Title = "无忧资讯 > 关于无忧";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }

                case (int)Constants.SubjectType.CompanyFastList:   //无忧快讯列表
                    {
                        this.Title = "无忧资讯 > 无忧快讯";
                        filePath = "~/userControls/Admin/BastContentList.ascx";
                        break;
                    }
                case (int)Constants.SubjectType.CompanyFastInfo:       //无忧快讯编辑
                    {
                        this.Title = "无忧资讯 > 无忧快讯";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }
                case (int)Constants.SubjectType.CompanyHRList:   //HR频道列表
                    {
                        this.Title = "无忧资讯 > HR频道";
                        filePath = "~/userControls/Admin/BastContentList.ascx";
                        break;
                    }
                case (int)Constants.SubjectType.CompanyHRInfo:       //HR频道编辑
                    {
                        this.Title = "无忧资讯 > 无忧快讯";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }
                case (int)Constants.SubjectType.CompanyManagerList:   //管理资讯列表
                    {
                        this.Title = "无忧资讯 > 管理资讯";
                        filePath = "~/userControls/Admin/BastContentList.ascx";
                        break;
                    }
                case (int)Constants.SubjectType.CompanyManagerInfo:       //管理资讯编辑
                    {
                        this.Title = "无忧资讯 > 管理资讯";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }
                case (int)Constants.SubjectType.CompanyIndustryList:   //行业动态列表
                    {
                        this.Title = "无忧资讯 > 行业动态";
                        filePath = "~/userControls/Admin/BastContentList.ascx";
                        break;
                    }
                case (int)Constants.SubjectType.CompanyIndustryInfo:       //行业动态编辑
                    {
                        this.Title = "无忧资讯 > 行业动态";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }
                case (int)Constants.SubjectType.CompanyBBS:           //无忧论坛
                    {
                        this.Title = "无忧资讯 > 无忧论坛";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }

                case (int)Constants.SubjectType.CompanyContactMethod: //联系我们
                    {
                        this.Title = "无忧资讯 > 联系我们";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }

                case (int)Constants.SubjectType.HunterDescription:    //猎头说明
                    {
                        this.Title = "无忧猎头 > 猎头说明";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }

                case (int)Constants.SubjectType.HunterPositionList:   //猎头职位列表
                    {
                        this.Title = "业务管理 > 猎头职位";
                        filePath = "~/userControls/Admin/HunterJobList.ascx";
                        break;
                    }
                case (int)Constants.SubjectType.HunterPositionIfo:    //猎头职位编辑                
                    {
                        int view = myR["view"].IntValue;
                        if (view > 0)
                        {
                            this.Title = "业务管理 > 简历接收列表";
                            filePath = "~/userControls/Admin/ViewResumeReceive.ascx";
                        }
                        else
                        {
                            this.Title = "业务管理 > 猎头职位";
                            filePath = "~/userControls/Admin/HunterJobInfo.ascx";
                        }
                        break;
                    }
                
                case (int)Constants.SubjectType.HunterNewsList:       //猎头资讯列表
                    {
                        this.Title = "无忧猎头 > 猎头资讯";
                        filePath = "~/userControls/Admin/BastContentList.ascx";
                        break;
                    }

                case (int)Constants.SubjectType.HunterNewsInfo:       //猎头资讯编辑
                    {
                        this.Title = "无忧猎头 > 猎头资讯";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }

                case (int)Constants.SubjectType.HunterManagerAreaList:    //猎头管理专区
                    {
                        this.Title = "无忧猎头 > 管理专区";
                        filePath = "~/userControls/Admin/BastContentList.ascx";
                        break;
                    }
                case (int)Constants.SubjectType.HunterManagerAreaInfo:    //猎头管理专区
                    {
                        this.Title = "无忧猎头 > 管理专区";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }

                case (int)Constants.SubjectType.HunterContactMethod:  //猎头联系方式
                    {
                        this.Title = "无忧猎头 > 联系方式";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }

                case (int)Constants.SubjectType.ServiceDescription:      //人事外包业务说明
                    {
                        this.Title = "人事外包 > 业务说明";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }

                case (int)Constants.SubjectType.ServiceSuggestion:       //人事外包解决方案
                    {
                        this.Title = "人事外包 > 解决方案";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }

                case (int)Constants.SubjectType.ServiceQuestionList:      //人事外包政策咨询列表
                    {
                        this.Title = "人事外包 > 政策咨询";
                        filePath = "~/userControls/Admin/BastContentList.ascx";
                        break;
                    }

                case (int)Constants.SubjectType.ServiceQuestionInfo:      //人事外包政策咨询编辑
                    {
                        this.Title = "人事外包 > 政策咨询";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }

                case (int)Constants.SubjectType.ServiceAnalysisList:      //人事外包案例分析列表
                    {
                        this.Title = "人事外包 > 案例分析";
                        filePath = "~/userControls/Admin/BastContentList.ascx";
                        break;
                    }

                case (int)Constants.SubjectType.ServiceAnalysisInfo:      //人事外包案例分析编辑
                    {
                        this.Title = "人事外包 > 案例分析";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }

                case (int)Constants.SubjectType.ServiceContactMethod:     //人事外包联系方式
                    {
                        this.Title = "人事外包 > 联系方式";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }

                case (int)Constants.SubjectType.AdminManagerList:                //系统管理员列表
                    {
                        this.Title = "其它管理 > 系统管理员";
                        filePath = "~/userControls/Admin/AdminUserList.ascx";
                        break;
                    }

                case (int)Constants.SubjectType.AdminManagerInfo:                 //系统管理员编辑
                    {
                        this.Title = "其它管理 > 系统管理员";
                        filePath = "~/userControls/Admin/AdminUserInfo.ascx";
                        break;
                    }

                case (int)Constants.SubjectType.AdminChangePassword:                 //系统管理员编辑
                    {
                        this.Title = "其它管理 > 更改密码";
                        filePath = "~/userControls/Admin/AdminPassword.ascx";
                        break;
                    }
                case (int)Constants.SubjectType.OtherFriendLink:                 //友情链接
                    {
                        this.Title = "其它管理 > 友情链接";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }
                case (int)Constants.SubjectType.OtherPersonHelp:                 //求职者帮助
                    {
                        this.Title = "其它管理 > 求职者帮助";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }
                case (int)Constants.SubjectType.OtherCompanyHelp:                 //企业帮助
                    {
                        this.Title = "其它管理 > 企业帮助";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }
                case (int)Constants.SubjectType.OtherCustomerCenter:                 //客户中心
                    {
                        this.Title = "其它管理 > 客户中心";
                        filePath = "~/userControls/Admin/BaseContent.ascx";
                        break;
                    }
                case (int)Constants.SubjectType.AdvanceCustomer:
                    {
                        this.Title = "其它管理 > LOGO管理";
                        filePath = "~/userControls/Admin/LogoManager.ascx";
                        break;
                    }
                case (int)Constants.SubjectType.AdvanceCustomerList:
                    {
                        this.Title = "其它管理 > LOGO管理";
                        filePath = "~/userControls/Admin/LogoManangerList.ascx";
                        break;
                    }
                case (int)Constants.DictionaryType.ADDR_CITY:
                    {
                        this.Title = "字典管理 > 区域";
                        if ( isEdit )
                            filePath = "~/userControls/Admin/LevelDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/LevelDictionaryList.ascx";
                        break;
                    }
                case (int)Constants.DictionaryType.COMPANY_PROPERTY:
                    {
                        this.Title = "字典管理 > 公司属性";
                        if ( isEdit )
                            filePath = "~/userControls/Admin/CommonDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/CommonDictionaryList.ascx";
                        break;
                    }
                case (int)Constants.DictionaryType.COMPANY_SCOPE:
                    {
                        this.Title = "字典管理 > 公司规模";
                        if (isEdit)
                            filePath = "~/userControls/Admin/CommonDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/CommonDictionaryList.ascx";
                        break;
                    }
                case (int)Constants.DictionaryType.EAT_ROOM:
                    {
                        this.Title = "字典管理 > 食宿条件";
                        if (isEdit)
                            filePath = "~/userControls/Admin/CommonDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/CommonDictionaryList.ascx";
                        break;
                    }
                case (int)Constants.DictionaryType.EDUCATION_LEVEL:
                    {
                        this.Title = "字典管理 > 学历";
                        if (isEdit)
                            filePath = "~/userControls/Admin/CommonDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/CommonDictionaryList.ascx";
                        break;
                    }
                case (int)Constants.DictionaryType.FOREIGN_LANG:
                    {
                        this.Title = "字典管理 > 外语种类";
                        if (isEdit)
                            filePath = "~/userControls/Admin/CommonDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/CommonDictionaryList.ascx";
                        break;
                    }
                case (int)Constants.DictionaryType.INDUSTRY_CLASS:
                    {
                        this.Title = "字典管理 > 行业";
                        if ( isEdit )
                            filePath = "~/userControls/Admin/LevelDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/LevelDictionaryList.ascx";
                        break;
                    }
                case (int)Constants.DictionaryType.LANG_CERTIFY:
                    {
                        this.Title = "字典管理 > 外语证书";
                        if (isEdit)
                            filePath = "~/userControls/Admin/CommonDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/CommonDictionaryList.ascx";
                        break;
                    }
                case (int)Constants.DictionaryType.LANG_SKILL:
                    {
                        this.Title = "字典管理 > 熟练程度";
                        if (isEdit)
                            filePath = "~/userControls/Admin/CommonDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/CommonDictionaryList.ascx";
                        break;
                    }
                case (int)Constants.DictionaryType.MARRY_STATE:
                    {
                        this.Title = "字典管理 > 婚姻状态";
                        if (isEdit)
                            filePath = "~/userControls/Admin/CommonDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/CommonDictionaryList.ascx";
                        break;
                    }
                case (int)Constants.DictionaryType.PERSON_CLASS:
                    {
                        this.Title = "字典管理 > 求职者内部分类";
                        if (isEdit)
                            filePath = "~/userControls/Admin/CommonDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/CommonDictionaryList.ascx";
                        break;
                    }
                case (int)Constants.DictionaryType.PERSON_NATIONALITY:
                    {
                        this.Title = "字典管理 > 民族";
                        if (isEdit)
                            filePath = "~/userControls/Admin/CommonDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/CommonDictionaryList.ascx";
                        break;
                    }
                case (int)Constants.DictionaryType.POSITION_CLASS:
                    {
                        this.Title = "字典管理 > 职位类别";
                        if (isEdit)
                            filePath = "~/userControls/Admin/LevelDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/LevelDictionaryList.ascx";
                        break;
                    }



                case (int)Constants.DictionaryType.IT_ABILITY:
                    {
                        this.Title = "字典管理 > IT技能";
                        if (isEdit)
                            filePath = "~/userControls/Admin/LevelDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/LevelDictionaryList.ascx";
                        break;
                    }

                case (int)Constants.DictionaryType.CERTIFICATE_NAME:
                    {
                        this.Title = "字典管理 > 证书";
                        if (isEdit)
                            filePath = "~/userControls/Admin/LevelDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/LevelDictionaryList.ascx";
                        break;
                    }


                case (int)Constants.DictionaryType.SALARY_LEVEL:
                    {
                        this.Title = "字典管理 > 薪资水平";
                        if (isEdit)
                            filePath = "~/userControls/Admin/CommonDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/CommonDictionaryList.ascx";
                        break;
                    }
                case (int)Constants.DictionaryType.SPECIALTY_CLASS:
                    {
                        this.Title = "字典管理 > 专业";
                        if (isEdit)
                            filePath = "~/userControls/Admin/LevelDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/LevelDictionaryList.ascx";
                        break;
                    }
                case (int)Constants.DictionaryType.TECH_TITLE:
                    {
                        this.Title = "字典管理 > 职称";
                        if (isEdit)
                            filePath = "~/userControls/Admin/CommonDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/CommonDictionaryList.ascx";
                        break;
                    }
                case (int)Constants.DictionaryType.CURRENT_WORKSTATUS:
                    {
                        this.Title = "字典管理 > 工作状态";
                        if (isEdit)
                            filePath = "~/userControls/Admin/CommonDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/CommonDictionaryList.ascx";
                        break;
                    }
                case (int)Constants.DictionaryType.APPLY_TYPE:
                    {
                        this.Title = "字典管理 > 求职类型";
                        if (isEdit)
                            filePath = "~/userControls/Admin/CommonDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/CommonDictionaryList.ascx";
                        break;
                    }
                case (int)Constants.DictionaryType.PARTICIPATE_LEN:
                    {
                        this.Title = "字典管理 > 到岗时间";
                        if (isEdit)
                            filePath = "~/userControls/Admin/CommonDictionaryInfo.ascx";
                        else
                            filePath = "~/userControls/Admin/CommonDictionaryList.ascx";
                        break;
                    }
                case (int)Constants.SubjectType.CompanySearcher:
                    {
                        int type = myR["type"].IntValue;                        
                        switch (type)
                        {
                            case 1:
                                this.Title = "业务管理 > 求职者列表";
                                filePath = "~/userControls/common/PersonList.ascx";
                                break;
                            case 2:
                                this.Title = "业务管理 > 求职者搜索";
                                filePath = "~/userControls/common/CompanySearcherInfo.ascx";
                                break;
                            default:
                                this.Title = "业务管理 > 求职者搜索器";
                                filePath = "~/userControls/common/CompanySearcherList.ascx";
                                break;
                        }
                        break;
                    }

                case (int)Constants.SubjectType.PersonSearhcer1:
                    {
                        int type = myR["type"].IntValue;                        
                        switch (type)
                        {
                            case 1:
                                this.Title = "业务管理 > 企业列表";
                                filePath = "~/userControls/common/CompanyList.ascx";
                                break;
                            case 2:
                                this.Title = "业务管理 > 企业搜索";
                                filePath = "~/userControls/common/PersonSearcher1Info.ascx";
                                break;
                            default:
                                this.Title = "业务管理 > 企业搜索器";
                                filePath = "~/userControls/common/PersonSearcher1List.ascx";
                                break;
                        }
                        break;
                    }


                default:
                    {
                        this.Title = "业务管理 > 求职者搜索";
                        filePath = "~/userControls/common/CompanySearcherInfo.ascx";
                        break;
                    }
            }
            this.LoadCtrl(filePath);
        }
    }
}
